<?php

/**
 * @file z_graphs.php
 * @brief Test for drawing Charts
 * @author DyrTechnologies
 * @version V 1.0
 * @date Thu Dec 20 2007
 *
 *  Part of the CEFIRO dynamic web framework project
 *
 *  Copyright (C) 2007  Dyr technologies http://dyrtech.com.ve
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

if (!defined('CEFIRO')) define("CEFIRO",substr(__FILE__,0,strpos(__FILE__,"cefiro"))."cefiro/widgets/cefiro.php");
require_once(CEFIRO);
require_once(CEF_GANTT);
require_once(CEF_INPUT);

if ($ingresar||$eliminar){
	$tabla1 = Vacaciones::consultarVacacionesXUN($idun,true);
}

/**
 * @brief Diagŕama de gantt de los resultados obtenidos con la busqueda anterior
 */
if(!$enviar&&!$estado){
}

function getGraphs($args){
	
	$starts 	= array("01/03/2007","03/01/2007","15/02/2007","11/03/2007","25/01/2007");
	$ends 		= array("07/03/2007","18/01/2007","02/03/2007","20/03/2007","10/02/2007");
	$names 		= array("Robert","Charles","Derik","Peter","Leonardo");
	$lastnames 	= array("Smith","Cefiro","Romero","Zajax","Zuñiga");
	
	$table = null;
	for($i=0;$i<5;$i++){
		$table[$i]['startingDate'] 	= $starts[$i];
		$table[$i]['endingDate'] 	= $ends[$i];
		$table[$i]['Name'] 			= $names[$i];
		$table[$i]['Lastname'] 		= $lastnames[$i];
	}
	

	$gantt=new GanttCe('This is a Gantt Diagram',"530px","250px");
	$gantt->set_name('gantt');
	$gantt->set_data($table,'Name','Lastname','startingDate','endingDate');
	$gantt->display_gantt();

	global $smarty;
	$smarty->template_dir = dirname(__FILE__).'/';

	addAssign('widgetTitle','innerHTML',"<p class='title_blue'>Graphs</p>");
	addAssign('widgetDisplay','innerHTML',$smarty->fetch('z_graphs.tpl'));

	$src  = "<p>";
	$src .= "\$starts=array(\"01/03/2007\",\"03/01/2007\",\"15/02/2007\",\"11/03/2007\",\"25/01/2007\");<br>";
	$src .= "\$ends=array(\"07/03/2007\",\"18/01/2007\",\"02/03/2007\",\"20/03/2007\",\"10/02/2007\");<br>";
	$src .= "\$names=array(\"Robert\",\"Charles\",\"Derik\",\"Peter\",\"Leonardo\");<br>";
	$src .= "\$lastnames= array(\"Smith\",\"Cefiro\",\"Romero\",\"Zajax\",\"Zuñiga\");<br><br>";
	
	$src .= "\$table = null;<br>";
	$src .= "for(\$i=0;\$i<5;\$i++){<br>";
	$src .= "\$table[\$i]['startingDate'] 	= \$starts[\$i];<br>";
	$src .= "\$table[\$i]['endingDate'] 		= \$ends[\$i];<br>";
	$src .= "\$table[\$i]['Name'] 			= \$names[\$i];<br>";
	$src .= "\$table[\$i]['Lastname'] 		= \$lastnames[\$i];<br>";
	$src .= "}<br><br>";
	

	$src .= "\$gantt=new GanttCe('This is a Gantt Diagram',\"530px\",\"250px\");<br>";
	$src .= "\$gantt->set_name('gantt');<br>";
	$src .= "\$gantt->set_data(\$table,'Name','Lastname','startingDate','endingDate');<br>";
	$src .= "\$gantt->display_gantt();<br>";
	$src .= "</p>";


	addAssign('srcTitle','innerHTML',"<p class='title_red'>Source</p>");
	addAssign('srcDisplay','innerHTML',$src);

	addAssign('tplTitle','innerHTML',"<p class='title_green'>Smarty Template</p>");
	addAssign('tplDisplay','innerHTML',"<p>{\$gantt}</p>");

	return processResponse();

}

?>